package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.PageMemberDto;
import com.zzyl.nursing.dto.UserLoginDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import com.zzyl.serve.domain.NursingProject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 老人家属Controller
 * 
 * @author ruoyi
 * @date 2025-10-22
 */
@RestController
@RequestMapping("/member")
@Api(tags = "老人家属相关接口")
public class FamilyMemberController extends BaseController
{
    @Autowired
    private IFamilyMemberService familyMemberService;
    /**
     * 登录
     */

    @ApiOperation("小程序登录")
    @PostMapping("/user/login")
    public AjaxResult login(@RequestBody UserLoginDto dto) {

        LoginVo loginVo = familyMemberService.login(dto);

        return success(loginVo);
    }
    /**
     * 分页查询护理项目的列表
     */
    @GetMapping("/orders/project/page")
    public TableDataInfo pageList(PageMemberDto pageMemberDto){
                 startPage();
      List<NursingProject> list =familyMemberService.queryList(pageMemberDto);


        return getDataTable(list);
    }
    /**
     * 获取护理项目的详情
     */
    @GetMapping("//orders/project/{id}")
    public AjaxResult getProject(@PathVariable Long id){
        return AjaxResult.success(familyMemberService.getProject(id));
    }

}
